#version 330 core
layout(location = 0) in vec3 position;

out vec3 fragColor;

uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;

void main()
{
    // 设置三角形的顶点颜色
    if (gl_VertexID == 0) {
        fragColor = vec3(1.0, 0.0, 0.0); // 红色
    } else if (gl_VertexID == 1) {
        fragColor = vec3(0.0, 1.0, 0.0); // 绿色
    } else if (gl_VertexID == 2) {
        fragColor = vec3(0.0, 0.0, 1.0); // 蓝色
    }
    gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);
}